<?
/**
 *产品导航输出类.
 */
class Navi{
	/**
	 *导航输出函数.
	 *common/nav.php配置文件,记录导航路径.
	 *@param array $pages
	 *@param @depth
	 *return html
	 */
    public static function breadcrumb($pages, $depth) {
        $currentPage = basename($_SERVER['PHP_SELF']);
        $parent = $pages[$currentPage]['parent'];
        if($currentPage!='home.html') {
            if(is_numeric($parent)) {
                $dep = $parent;
                $nav = '<em>&gt;</em><span>'.$depth[$dep].'</span>'
                    .'<em>&gt;</em>'
                    .'<a href="javascript:;">'.$pages[$currentPage]['pageTitle'].'</a>';
            }
            else {
                $dep = $pages[$parent]['parent'];
                $nav = '<em>&gt;</em><span>'.$depth[$dep].'</span>'
                    .'<em>&gt;</em><a href="'.$parent.'">'
                    .$pages[$parent]['pageTitle'].'</a>'
                    .'<em>&gt;</em><a href="javascript:;">'
                    .$pages[$currentPage]['pageTitle'].'</a>';

            }
        }
    $host = explode('.', $_SERVER['HTTP_HOST']);
    switch($host[0]){
        case 'www':
            $url = //{$_SERVER['HTTP_HOST']}/home.html;
            break;
        default :
            $url = //{$_SERVER['HTTP_HOST']}/new/d/home.html
            break;
    }
        $sub_nav = <<< HTML
    <div class="subnav">
    您所在位置： <a href="$url">首页</a>
    {$nav}
</div>
HTML;
        return $sub_nav;
    }
}
?>